<?php
/**
 * Created by PhpStorm.
 * User: hisheng
 * Date: 2017/6/8
 * Time: 16:19
 */
namespace App\Http\Controllers\Api;

use App\Advice;
use App\Http\Controllers\Controller ;
use Illuminate\Support\Facades\Input;


class AdviceController extends Controller{
    public $advice;
    public function __construct(Advice $advice)
    {
        $this->advice = $advice;
    }
    
    public function postAdd(){
        $advice = Input::get('advice');
        if($advice){
            $this->advice->advice = $advice;
            $this->advice->user_id = Input::get('user_id',0);
            $this->advice->save();
            return $this->json($this->advice);
        }
        return $this->error('缺少advice');
    }
}